home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_100 / 187_01 / seconds.c < prev    next >
Text File  |  1985-12-29  |  1KB  |  41 lines

  1. /*@*******************************************************/
  2. /*@                                                      */
  3. /*@ seconds - return the current time-of-day in          */
  4. /*@        hundredths of seconds since midnight.         */
  5. /*@                                                      */
  6. /*@   Usage:     seconds();                              */
  7. /*@                                                      */
  8. /*@   Returns a long value representing the number       */
  9. /*@      of seconds since midnight (0 <= x <= 86,400)    */
  10. /*@                                                      */
  11. /*@*******************************************************/
  12.  
  13.  
  14. int hour, min, sec;
  15.  
  16. long seconds()
  17. {
  18.     
  19. #asm
  20.     PUSH    AX
  21.     PUSH    CX
  22.     PUSH    DX
  23.     MOV        AX,2C00H
  24.     INT        21H
  25.     MOV        AH,00
  26.     MOV        AL,CH
  27.     MOV        WORD hour_,AX
  28.     MOV        AL,CL
  29.     MOV        WORD min_,AX
  30.     MOV        AL,DH
  31.     MOV        WORD sec_,AX
  32.     POP        DX
  33.     POP        CX
  34.     POP        AX
  35. #endasm
  36.  
  37.     return ((long)hour * 3600 + (long)min * 60
  38.              + (long)sec);
  39.  
  40. }
  41.